﻿var line=new Array()
var ts_fontsize;
var longestmessage;
var tscroller_width;
temp=""
nextchar=-1;
nextline=1;
cursor=" _"

var e;
function DisplaySlogan(element)
{
var textSlogan="Công ty ôtô An Sương; 2450, QL1A, Trung Mỹ Tây, Quận 12, Tp.HCM";
var text = ";" + textSlogan;
line = text.split(";");

ts_fontsize="16px"
longestmessage=1
for (i=2;i<line.length;i++){
if (line[i].length>line[longestmessage].length)
longestmessage=i
}


tscroller_width=line[longestmessage].length

lines=line.length-1 //--Number of lines

e = document.getElementById(element);
animate()

}

function animate(){
if (temp==line[nextline] & temp.length==line[nextline].length & nextline!=lines){
nextline++;
nextchar=-1;
e.innerHTML=temp;
temp="";
setTimeout("nextstep()",3000)}
else if (nextline==lines & temp==line[nextline] & temp.length==line[nextline].length){
nextline=1;
nextchar=-1;
e.innerHTML=temp;
temp="";
setTimeout("nextstep()",3000)}
else{
nextstep()}}

function nextstep(){

cursor=" _"


nextchar++;
temp+=line[nextline].charAt(nextchar);
e.innerHTML=temp+cursor
setTimeout("animate()",70)}
